import { fliterPermission } from '@/utils/sys.js'

export const apis = {
  list: `/admin/basis/getList?modelCode=MODEL_OPETATE_LOG&authCode=FUNCTION_OPERATE_LOG_LIST`,
  detail: `admin/basis/detail?modelCode=MODEL_OPETATE_LOG&authCode=BTN_OPERATE_LOG__DETAIL`,
};
export const configs = {
  listUrl: apis.list,
  pageOn: true, // 开启分页
  searchOn: true, // 开启搜索
  operateOn: true, //开启操作区域
  treeOn: false, // 开启树形
};

export const searchs = [
  {
    type: "SelectModel",
    column: "manage_id",
    label: "操作管理员",
    modelCode: "MODEL_MANAGE",
    mapping : {
      label:['manage_account'],
      value: 'id'
    }
  },
  {
    type: "Select",
    column: "operate_type",
    label: "操作类型",
    dimCode: "DIM_TYPE_OPERATE_TYPE"
  }
];

export const pages = {
  pageSize: 20,
  orders: [
    {
      field: "id",
      sort: "desc",
    },
  ],
};
export const columns = [
  { type: "selection" },
  { label: "ID", column: "id", sortable: "custom", display: "text" },
  {
    label: "管理员",
    column: "manage_id",
    display: "detail",
    format:'model',
    config: {
      mode:'custom', //'default', 默认，custom自定义方式
      component: 'manage/components/Mode',
    }
  },
  {
    label: "标题",
    column: "operate_name",
  },
  {
    label: "类型",
    column: "operate_type",
    format:'dim',
    slot: "operateType"
  },

  {
    label: "路由",
    column: "operate_router",
  },
  {
    label: "IP",
    column: "operate_ip",
  },
  {
    label: "创建时间",
    column: "ctime",
    format: "datetime", 
  },
  {
    label: "操作",
    column: "operate",
    width: "80",
    fixed: "right",
  }
];

export const columnButtons = fliterPermission([
  {
    operate: "detail",
    text: "详情",
    permission: 'BTN_OPERATE_LOG__DETAIL',
  }
])
